package com.micro.magupe.sharding.connection;

import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;

import javax.sql.DataSource;

import com.micro.magupe.sharding.rule.ShardingRule;
import com.micro.magupe.sharding.statement.ShardingStatement;

public class ShardingConnection extends AbstractConnection{

	private final Map<String, DataSource> dataSourceMap;
	private final ShardingRule rule;
	
	public ShardingConnection(final Map<String, DataSource> dataSourceMap, final ShardingRule rule) throws SQLException {
		this.dataSourceMap = dataSourceMap; 
		this.rule = rule; 
	}
	
	@Override
	public DatabaseMetaData getMetaData() throws SQLException {
		return null;
	}
	
	@Override
	public Statement createStatement() throws SQLException {
		return new ShardingStatement(this);
	}

	@Override
	public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
		return null;
	}

	@Override
	public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
		return null;
	}

	@Override
	public PreparedStatement prepareStatement(String sql) throws SQLException {
		return null;
	}
	
	@Override
	public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
		return null;
	}
	
	@Override
	public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
		return null;
	}
	
	@Override
	public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
		return null;
	}

	@Override
	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
		return null;
	}
	
	@Override
	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
		return null;
	}

	public Map<String, DataSource> getDataSourceMap() {
		return dataSourceMap;
	}

	public ShardingRule getRule() {
		return rule;
	}
}
